Attachments Property (Message Object) 

The Attachments property returns a single Attachment object or an Attachments collection object. Read-only.

Syntax

Set objAttachColl = objMessage.Attachments

Set objOneAttach = objMessage.Attachments(index)

objAttachColl

Object. An Attachments collection object.

objMessage

Object. The Message object.

objOneAttach

Object. A single Attachment object.

index

Long. Specifies the number of the attachment within the Attachments collection. Ranges from 1 to the value specified by the Attachments collection s Count property.

 

Example

This example uses the Attachments property to retrieve an attachment for the message:

' from the sample function Message_Attachments

    Set objAttachColl = objOneMsg.Attachments

    If objAttachColl Is Nothing Then

        MsgBox "unable to set Attachments collection"

        Exit Function

    Else

        MsgBox "Attachments count for this msg: " & objAttachColl.Count

        iAttachCollIndex = 0    ' reset global index variable

    End If

' from the sample function Attachments_FirstItem

    iAttachCollIndex = 1

    Set objAttach = objAttachColl.Item(iAttachCollIndex)

 

See Also

Attachment Object

Attachments Collection2XOH1D